# coding: -utf-8

import urllib
__author__ = 'weixin.yuan'


def del_str_space(old_str):
    # 删除字符串中空格
    new_str = old_str.replace('\t', '').replace('\n', '').strip()
    return new_str


def str_to_dict(old_str):
    # 字符转字典
    return eval(old_str)


def dict_to_url(old_dic):
    # 字典转url
    return urllib.urlencode(old_dic)


if __name__ == '__main__':
    o_str = """
{
	"param":{
		"Source_TRNNavigator":true,
		"autoChangeTrain":{
			"action":{
				"clickable":true,
				"id":0,
				"menuBackColor":0,
				"menuColor":0,
				"msg":"您正在购买北京到唐山的车票，如需在齐齐哈尔下车，请在上车后补票。",
				"topDescBackColor":0,
				"topDescColor":0
			},
			"arrTime":"2019-08-08 02:14:00",
			"arrTimeHM":"02:14",
			"arrTimeYMD":"2019-08-08",
			"arrivalOffset":-21,
			"behindTo":false,
			"date":"2019-08-07",
			"dayAfter":"+1",
			"dayAfterMap":{
				"唐山":"+1"
			},
			"depTime":"2019-08-07 22:13:00",
			"depTimeHM":"22:13",
			"depTimeYMD":"2019-08-07",
			"departureOffset":0,
			"isBeginStation":"true",
			"isEndStation":"false",
			"lsdType":0,
			"minPrice":"40.5",
			"nextMorePrice":"0.0",
			"noSeatMinutes":1127,
			"noSeatTimeDesc":"19小时",
			"offTime":"2019-08-08 21:01:00",
			"offTimeHM":"21:01",
			"prevMorePrice":"0.0",
			"reArrStation":"唐山",
			"reBeginStation":"北京",
			"recommendFlag":2,
			"seatType":"硬座",
			"ticketGroup":1,
			"ticketInfos":[
				{
					"markColor":1,
					"remainTicket":11,
					"remainTicketDesc":"11张",
					"ticketPrice":"40.5",
					"ticketType":"硬座"
				},
				{
					"markColor":0,
					"remainTicket":100,
					"remainTicketDesc":"100张",
					"ticketPrice":"40.5",
					"ticketType":"无座"
				}
			],
			"timeInterval":"4时1分",
			"trainKey":"K1303",
			"trainMsg":"需补票21站",
			"trainNumber":"K1303",
			"trainType":"快速",
			"uFromCity":"北京",
			"uToCity":"齐齐哈尔",
			"upTime":"2019-08-07 22:13:00",
			"upTimeHM":"22:13"
		},
		"clickTime":1565168919400,
		"fareAdjust":"less",
		"hybridId":"train_rn",
		"isStudentSearch":false,
		"orderBookingFromSearchType":1,
		"trainLineParam":{
			"arr":"唐山",
			"date":"2019-08-07",
			"dep":"北京",
			"dptHm":"22:13",
			"trainNumber":"K1303"
		},
		"trainTicketType":1,
		"vcName":"qunaraphone://railway/react?pageName=OtaView&hybridId=train_rn"
	},
	"viewName":"OtaView"
}
    """
    print(del_str_space(o_str))
